package cn.neusoft.edu.his.demo.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import cn.neusoft.edu.his.demo.po.DoctorWork;
import cn.neusoft.edu.his.demo.po.FullDoctorWork;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@Mapper
public interface DoctorWorkMapper extends BaseMapper<DoctorWork>{
	@Select("SELECT	d.*, dw.fee_id,dw.DAY,dw.amwork,dw.pmwork FROM doctor d left join	doctor_work dw on d.doc_id = dw.doc_id where dw.day='${day}'")	
	List<FullDoctorWork> selectAllInfo(@Param("day")String day);

	@Update("update doctor_work set count_left=count_left-1 where count_left>0 and day='${day}' and doc_id='${docId}'")
	int updateCountLeftById(DoctorWork dw);
	
	@Update("update doctor_work set count_left=count_left+1 where  day='${day}' and doc_id='${docId}'")
	int updateCountLeftById2(DoctorWork dw);
}
